//
// Created by alexa on 5/5/2024.
//

#include "Battalion.h"

vector<string> Battalion::getAllUnitsIds() {
    return unitsIds;
}

void Battalion::removeUnitId(string unitId) {
    for (auto iter = unitsIds.begin(); iter != unitsIds.end(); iter++) {
        if (*iter == unitId) {
            auto found = *iter;
            unitsIds.erase(iter);
            break;
        }
    }
}

void Battalion::addUnitId(string unitId) {
    unitsIds.push_back(unitId);
}


Battalion::Battalion(const string &name) : name(name) {}

const string &Battalion::getName() const {
    return name;
}

Battalion &Battalion::operator+=(string unitId) {
    addUnitId(unitId);
    return *this;
}

Battalion &Battalion::operator-=(string unitId) {
    removeUnitId(unitId);
    return *this;
}
